<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="/common/common.jspf" %>
<script type="text/javascript">
    //单独验证某一个input  class="checkpass"
    jQuery.validator.addMethod("checkRole", function(value, element) {
        return this.optional(element) || ((value.length <= 10) && (value.length>=3));
    }, "角色名由3至10位字符组合构成");
    $(function() {
        $("form").validate({
            submitHandler : function(form) {//必须写在验证前面，否则无法ajax提交
                ly.ajaxSubmit(form,{//验证新增是否成功
                    type : "post",
                    dataType:"json",
                    success : function(data) {
                        if (data=="success") {
                            layer.confirm('添加成功!是否关闭窗口?', function(index) {
                                parent.grid.loadData();
                                parent.layer.close(parent.pageii);
                                return false;
                            });
                            $("#form")[0].reset();
                        } else {
                            layer.msg('添加失败！');
                        }
                    }
                });
            },
            errorPlacement : function(error, element) {//自定义提示错误位置
                $(".l_err").css('display','block');
                //element.css('border','3px solid #FFCCCC');
                $(".l_err").html(error.html());
            },
            success: function(label) {//验证通过后
                $(".l_err").css('display','none');
            }
        });
    });


</script>
<style type="text/css">
.col-sm-3 {
	width: 15%;
	float: left;
}

.col-sm-9 {
	width: 85%;
	float: left;
}
label[class^="btn btn-default"]{
	margin-top: -4px;
}
</style>
</head>
<body>
	<div class="l_err" style="width: 100%; margin-top: 2px;"></div>
	<form id="form" name="form" class="form-horizontal" method="post"
		action="${ctx}/curr/addEntity.shtml">
		<section class="panel panel-default">
		<div class="panel-body">
			<div class="form-group">
				<label class="col-sm-3 control-label">课程名称</label>
				<div class="col-sm-9">
					<input type="text" class="form-control checkacc"
						placeholder="请输入课程名称" name="curriculumFormMap.currName" id="currName">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label">课程类型</label>
				<div class="col-sm-9">
					<select  name="curriculumFormMap.currType" id="currType" >
						<option value="0">--请选择--</option>
						<option value="1">数学</option>
						<option value="2">语文</option>
						<option value="3">英语</option>
					</select>
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label">描述</label>
				<div class="col-sm-9">
					<input type="text" class="form-control" placeholder="请输入账号描述"
						name="curriculumFormMap.description" id="description">
				</div>
			</div>


			<div class="line line-dashed line-lg pull-in"></div>
		</div>
		<footer class="panel-footer text-right bg-light lter">
			<button type="submit" class="btn btn-success btn-s-xs">提交</button>
		</footer> 
		</section>
	</form>
</body>
</html>